home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 25
/
Aminet 25 (1998)(GTI - Schatztruhe)[!][Jun 1998].iso
/
Aminet
/
comm
/
net
/
AMarquee1_48.lha
/
AMarquee
/
examples
/
killclients.rexx
< prev
next >
Wrap
OS/2 REXX Batch file
|
1998-04-10
|
2KB
|
87 lines
/*************************************************
killclients.rexx
Author: Jeremy Friesner (jaf@chem.ucsd.edu)
An ARexx script that will kick off localhost's
AMarqueed server any AMarquee clients that match
the given description.
Usage: rx killclients.rexx hostnames [lognames]
(hostnames) should be a regular expression denoting
the hostnames of the client or clients to be kicked
off. (e.g. sdcc8.ucsd.edu or #?.edu)
(lognames) should be a regular expression denoting
the lognames of the AMarquee client or clients to
be kicked off (e.g. #?Netris or QAmiTrack). If
not specified, it will default to #?.
Example: rx killclients.rexx #? #?
Note that you must have given localhost
AMARQUEED_KILLCLIENTS privilege in order for
this script to work.
***************************************************/
parse arg hostnames lognames .
if ((serverName == '?')|(length(hostnames) = 0)) then do
say "Usage: rx killclients.rexx <hostnames> [logNames]"
exit
end
serverName = 'localhost' /* hardcoded for now */
portNum = 2957
logName = 'killclients.rexx'
if (length(lognames) = 0) then lognames = '#?'
/* We need to trap all the different ways the script could exit,
so that we can be sure any allocated QSessions or QMessages are
freed properly */
signal on error
signal on syntax
signal on halt
signal on break_c
/* Used to track allocated QSession */
session = 0
/* Note the offset MUST be -204, and not -30 like in many other
libraries! Note also that we require amarquee.library v46 or higher */
check = addlib('amarquee.library', 0, -204, 46)
say "Connecting to server " || serverName || " on port " || portNum || " as " || logName
session = QNewSession(serverName, portNum, logName)
if (session > 0) then
do
victims = "/" || hostnames || "/" || lognames
say "Killing: " || victims
call QRequestPrivilegesOp(session, QPRIV_KILLCLIENTS)
/* Note that this won't work if the server doesn't give us
this privilege; this script doesn't check to see if the
privilege was actually granted, but rather assumes that it
was. */
call QKillClientsOp(session,victims)
/* And off it goes... */
call QGo(session)
end
/* Our error handling/cleanup routine starts here */
ERROR:
SYNTAX:
HALT:
BREAK_C:
say "Cleaning up..."
if (session > 0) then do
call QFreeSession(session)
end
exit